<?php

namespace Album\Model;

use Zend\InputFilter\InputFilter;
use Zend\InputFilter\InputFilterAwareInterface;
use Zend\InputFilter\InputFilterInterface;

abstract class Marketing implements InputFilterAwareInterface {
	public $id;
	public $name;
	public $description;
	public $fromname;
	public $fromaddress;
	public $anyonecansubscribe;
	public $ownedsecurableitem_id;
	protected $inputFilter;

	public function exchangeArray($data)
	{
		$this->id     = (isset($data['id']))     ? $data['id']     : null;
		$this->name = (isset($data['name'])) ? $data['name'] : null;
		$this->description  = (isset($data['description']))  ? $data['description']  : null;
		$this->fromname     = (isset($data['fromname']))     ? $data['fromname']     : null;
		$this->fromaddress = (isset($data['fromaddress'])) ? $data['fromaddress'] : null;
		$this->anyonecansubscribe  = (isset($data['anyonecansubscribe']))  ? $data['anyonecansubscribe']  : null;
		$this->ownedsecurableitem_id     = (isset($data['ownedsecurableitem_id']))     ? $data['ownedsecurableitem_id']     : null;
	}
	
	public function setInputFilter(InputFilterInterface $inputFilter)
	{
		throw new \Exception("Not used");
	}
	
	public function getInputFilter() {
		if (!$this->inputFilter) {
			$inputFilter = new InputFilter();
		
			$inputFilter->add(array(
					'name'     => 'id',
					'required' => true,
					'filters'  => array(
							array('name' => 'Int'),
					),
			));
			
			$inputFilter->add(array(
					'name'     => 'name',
					'required' => true,
					'filters'  => array(
							array('name' => 'StripTags'),
							array('name' => 'StringTrim'),
					),
					'validators' => array(
							array(
									'name'    => 'StringLength',
									'options' => array(
											'encoding' => 'UTF-8',
											'min'      => 1,
											'max'      => 30,
									),
							),
					),
			));
			
			$inputFilter->add(array(
					'name'     => 'description',
					'required' => true,
					'filters'  => array(
							array('name' => 'StripTags'),
							array('name' => 'StringTrim'),
					),
					'validators' => array(
							array(
									'name'    => 'StringLength',
									'options' => array(
											'encoding' => 'UTF-8',
											'min'      => 1,
											'max'      => 250,
									),
							),
					),
			));
			
			$inputFilter->add(array(
					'name'     => 'fromname',
					'required' => true,
					'filters'  => array(
							array('name' => 'StripTags'),
							array('name' => 'StringTrim'),
					),
					'validators' => array(
							array(
									'name'    => 'StringLength',
									'options' => array(
											'encoding' => 'UTF-8',
											'min'      => 1,
											'max'      => 100,
									),
							),
					),
			));
			
			$inputFilter->add(array(
					'name'     => 'fromaddress',
					'required' => true,
					'filters'  => array(
							array('name' => 'StripTags'),
							array('name' => 'StringTrim'),
					),
					'validators' => array(
							array(
									'name'    => 'StringLength',
									'options' => array(
											'encoding' => 'UTF-8',
											'min'      => 6,
											'max'      => 20,
									),
							),
					),
			));
			
			$inputFilter->add(array(
					'name'     => 'anyonecansubscribe',
					'required' => true,
					'filters'  => array(
							array('name' => 'StripTags'),
							array('name' => 'StringTrim'),
					),
					'validators' => array(
							array(
									'name'    => 'BooleanLength',
									'options' => array(
											'encoding' => 'UTF-8',
											'min'      => 1,
											'max'      => 1,
									),
							),
					),
			));
			
			$inputFilter->add(array(
					'name'     => 'ownedsecurableitem_id',
					'required' => true,
					'filters'  => array(
							array('name' => 'StripTags'),
							array('name' => 'StringTrim'),
					),
					'validators' => array(
							array(
									'name'    => 'NumberLength',
									'options' => array(
											'encoding' => 'UTF-8',
											'min'      => 1,
											'max'      => 5,
									),
							),
					),
			));
			
			$this->inputFilter = $inputFilter;
			
			}
			
			return $this->inputFilter;
			}
		
	}

	
	
